{% extends 'base.html' %}

{% block pagetitle %}Team Homepage{% endblock %}
{% block title %}Team Homepage{% endblock %}
{% block content %}
{% load filters %}
{% autoescape off %}
<span class="teamName"><span class="field-name">Team Name:</span> {{ currentTeamRanking.Team.Name }} </span><br />
<span class="currentTeamRanking"><span class="field-name">Record:</span> {{ currentTeamRanking.wins }}-{{currentTeamRanking.losses}} </span><br /><span class="currentTeamRankingLivingUnit">Floor/Wing: {{ currentTeamRanking.LivingUnit }} </span><br />
<span class="sportName"><span class="field-name">Sport:</span> {{ currentTeamRanking.Team.Division.League.Season.Sport }} </span><br />
<span class="leagueName"><span class="field-name">League:</span> {{ currentTeamRanking.Team.Division.League }} </span><br />
<span class="teamCaptain"><span class="field-name">Team Captain:</span> {{ currentTeamRanking.Team.Captain }} </span><br />
<hr/>
<table class="standings">
  <tr><th>Team</th><th>Wins</th><th>Losses</th></tr>
  {% for teamRanking in teamRankingList %}
      <tr><td>{{teamRanking.Team}}</td><td>{{teamRanking.wins}}</td><td>{{teamRanking.losses}}</td></tr>
  {% endfor %}
</table>
<fieldset>
<div>
<legend style="font-weight:bold;">Team Members </legend>
  <ul>
  {% for member in memberList.all %}
      <li>{{ forloop.counter }}. {{ member }}</li>
  {% endfor %}
  </ul>
</div>
</fieldset>
<hr/>
<table width="100%">
  <tr style="font-weight:bold">
    <td>Date</td>
    <td>Time</td>
    <td>Home</td>
    <td></td>
    <td>Away</td>
    <td>Location</td>
    <td>Referees</td>
  </tr>
{% for game in gameList %}
    <tr>
      <td>{{ game.StartTime|date:"D d M Y" }}</td>
      <td>{{ game.StartTime|date:"g:i" }}</td>
      <td class = "{{game.homewin}}">{{ game.HomeTeam}}</td>
      <td>vs.</td>
      <td class = "{{game.awaywin}}">{{ game.AwayTeam }}</td>
      <td>{{ game.Location }}</td>
      <td>
       {% for ref in game.Referees.all %}
         {{ ref }} {% if not forloop.last %},{% endif %}
       {% empty %}
         None
       {% endfor %}
      </td>
    </tr>
{% endfor %}
{% endautoescape %}
</table>



{% endblock %}
